import java.applet.*; import java.awt.*; import java.awt.event.*; class MyFrame extends Frame implements ActionListener { Button b1,b2,b3; public MyFrame() { this.setLayout(null); b1=new Button(); add(b1); b1.addActionListener(this); b2=new Button(); add(b2); b2.addActionListener(this); b3=new Button(); add(b3); b3.addActionListener(this); b1.setBackground(Color.red); b2.setBackground(Color.green); b3.setBackground(Color.blue); b1.setBounds(200,15,90,50); b2.setBounds(200,75,90,50); b3.setBounds(200,135,90,50); } public void actionPerformed(ActionEvent e) { Button bs=(Button)e.getSource(); Color cs=bs.getBackground(); Graphics g=this.getGraphics(); g.setColor(cs); g.fillOval(25,25,150,150); } } class demo { public static void main(String args[]) { MyFrame frm=new MyFrame(); frm.setVisible(true); frm.setSize(400,300); } }